// 实现选项卡功能
function init() {
  // TODO 待补充代码
  const tabs = [...document.querySelectorAll(".tabs div")]
  const content = [...document.querySelectorAll("#content div")]
  for (const i in tabs) {
    tabs[i].addEventListener(
      "click",
      function () {
        clear()
        this.classList.add("active")
        content[i].classList.add("active")
      },
      false
    )
  }

  function clear() {
    for (const item of tabs) {
      item.classList.remove("active")
    }
    for (const item of content) {
      item.classList.remove("active")
    }
  }
}
init()
